package com.hnn.controller;

import com.hnn.service.UserService;
import com.hnn.types.User;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hnn
 * @version 1.0
 * @date 2025-05-12 10:10
 */
@RequiredArgsConstructor
@RestController
public class TestCacheController {

    private final UserService userService;

    @PostMapping("/testCache")
    @ResponseBody
    public User testCache(Long id) {
        return userService.getUserById(id);
    }

    @PostMapping("/testCacheEvict")
    public void testCacheEvict(Long id) {
        userService.deleteUserById(id);
    }
}
